<?php

/**
 * This is the model class for table "puskesmasperawatan".
 *
 * The followings are the available columns in table 'puskesmasperawatan':
 * @property integer $ppr_id
 * @property integer $ppr_kec
 * @property integer $ppr_nonperawatan
 * @property integer $ppr_perawatan
 * @property integer $ppr_pembantu
 * @property integer $ppr_keliling
 * @property integer $ppr_posyando
 * @property integer $ppr_tahun
 *
 * The followings are the available model relations:
 * @property Kecamatan $pprKec
 */
class Puskesmasperawatan extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @return Puskesmasperawatan the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'puskesmasperawatan';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('ppr_kec, ppr_nonperawatan, ppr_perawatan, ppr_pembantu, ppr_keliling, ppr_posyando, ppr_tahun', 'numerical', 'integerOnly'=>true),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('ppr_id, ppr_kec, ppr_nonperawatan, ppr_perawatan, ppr_pembantu, ppr_keliling, ppr_posyando, ppr_tahun', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'pprKec' => array(self::BELONGS_TO, 'Kecamatan', 'ppr_kec'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'ppr_id' => 'Ppr',
			'ppr_kec' => 'Ppr Kec',
			'ppr_nonperawatan' => 'Ppr Nonperawatan',
			'ppr_perawatan' => 'Ppr Perawatan',
			'ppr_pembantu' => 'Ppr Pembantu',
			'ppr_keliling' => 'Ppr Keliling',
			'ppr_posyando' => 'Ppr Posyando',
			'ppr_tahun' => 'Ppr Tahun',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('ppr_id',$this->ppr_id);
		$criteria->compare('ppr_kec',$this->ppr_kec);
		$criteria->compare('ppr_nonperawatan',$this->ppr_nonperawatan);
		$criteria->compare('ppr_perawatan',$this->ppr_perawatan);
		$criteria->compare('ppr_pembantu',$this->ppr_pembantu);
		$criteria->compare('ppr_keliling',$this->ppr_keliling);
		$criteria->compare('ppr_posyando',$this->ppr_posyando);
		$criteria->compare('ppr_tahun',$this->ppr_tahun);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}